import React, { useState } from "react";
import "./index.less";
import { HTML5Backend } from 'react-dnd-html5-backend'
import { DndProvider } from 'react-dnd'

export const LowCodeDesignerContext = React.createContext<any>({
  components: {},
  currentDesigner: null,
});

export const LowCodeDesignerProvider = ({ children }) => {
  
  const [currentDesigner, setCurrentDesigner] = useState<any>({
    _id:null,
    type:null
  });

  return (
    <DndProvider backend={HTML5Backend}>
      <LowCodeDesignerContext.Provider
        value={{
          currentDesigner,
          setCurrentDesigner,
        }}
      >
          {children}
      </LowCodeDesignerContext.Provider>
    </DndProvider>
  );
};
